/***************************************************
Class: WorldTransformation
Includes: stdafx.h
Editors: Gindi
Existing Issues: None
Description: Initializes, sets, and returns a world transformation.
Every MeshInstance object has a WorldTransformation.
***************************************************/
#pragma once

#include "stdafx.h"

class WorldTransform {
public:
	WorldTransform();
	~WorldTransform() { Reset(); }

	void Reset();
	void translateAbs(float x, float y, float z);
	void translateRel(float x, float y, float z);
	void rotateAbs(float x, float y, float z);
	void rotateRel(float x, float y, float z);
	void scaleAbs(float x, float y, float z);
	void scaleRel(float x, float y, float z);

	D3DXMATRIX* getTransform();
	D3DXVECTOR3* getPosition()		{ return &m_position; }
	float getXPosition()			{ return m_translate._41; }
	float getYPosition()			{ return m_translate._42; }
	float getZPosition()			{ return m_translate._43; }
	float getXRotation()			{ return m_rotationX; }
	float getYRotation()			{ return m_rotationY; }
	float getZRotation()			{ return m_rotationZ; }
	float getXScale()				{ return m_scale._11; }
	float getYScale()				{ return m_scale._22; }
	float getZScale()				{ return m_scale._33; }
	void setXPosition(float x)		{ m_translate._41 = x; }
	void setYPosition(float y)		{ m_translate._42 = y; }
	void setZPosition(float z)		{ m_translate._43 = z; }
	void setXRotation(float x)		{ rotateAbs(x, m_rotationY, m_rotationZ); }
	void setYRotation(float y)		{ rotateAbs(m_rotationX, y, m_rotationZ); }
	void setZRotation(float z)		{ rotateAbs(m_rotationX, m_rotationY, z); }
	void setXScale(float x)			{ m_scale._11 = x; }
	void setYScale(float y)			{ m_scale._22 = y; }
	void setZScale(float z)			{ m_scale._33 = z; }

	// lari
	void setPrevPos(D3DXVECTOR3 prev){
		m_prevPosition = prev;
	}
	D3DXVECTOR3 * getPrevPos(){
		return &m_prevPosition;
	}
	// end:lari
protected:
	D3DXMATRIX		m_translate;
	D3DXMATRIX		m_rotate;
	D3DXMATRIX		m_scale;
	D3DXMATRIX		m_transform;
	D3DXVECTOR3		m_position;
	D3DXVECTOR3		m_prevPosition;
	float			m_rotationX, m_rotationY, m_rotationZ;
};
